#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const int N = 1e5 + 10;
#define INF 0x3f3f3f3f;
typedef long long int ll;
#define close(); std::ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
//----------------------------------------------------------------------------//

int a[N];
int n, m;

struct Trie
{
    Trie *son[2];
    int idx;
    bool isEnd;
    Trie()
    {
        idx = 0;
        isEnd = false;
        son[0] = son[1] = nullptr;
    }
};
Trie *root = new Trie();

void insert(int x, int index)
{
    Trie *p = root;
    for(int i = 30; i >= 0; --i)
    {
        int c = x >> i & 1;
        if(!p->son[c])
        {
            p->son[c] = new Trie();
        }
        p = p->son[c];
        p->idx = max(p->idx, index);
    }
    p->isEnd = true;
}

int query(int x, int limit)
{
    int res = 0;
    Trie *p = root;
    for(int i = 30; i >= 0; --i)
    {
        int c = x >> i & 1;
        if(p->son[!c] && p->son[!c]->idx >= limit)
        {
            res += 1 << i;
            p = p->son[!c];
        }
        else if(p->son[c] && p->son[c]->idx >= limit)
        {
            p = p->son[c];
        }
        else
        {
            break;
        }
    }

    return res;
}

int main()
{
    cin >> n >> m;
    for(int i = 1; i <= n; ++i)
    {
        cin >> a[i];
        a[i] ^= a[i - 1];
    }


    int res = 0;
    insert(0, 0);
    for(int i = 1; i <= n; ++i)
    {
        res = max(res, query(a[i], i - m));
        insert(a[i], i);
    }
    cout << res << '\n';
    return 0;
}

